﻿using System;
using System.Xml.Serialization;

namespace Interscape.TwilioClient.Components
{

    /// <summary>
    /// A collection of <see cref="IncomingPhoneNumber">IncomingPhoneNumber</see> objects.
    /// </summary>
    [Serializable]
    [XmlRoot("IncomingPhoneNumbers")]
    public class IncomingPhoneNumberList : PagedList<IncomingPhoneNumber>
    {
    }

    /// <summary>
    /// An IncomingPhoneNumber resource represents a phone number given to you by Twilio to receive incoming phone calls. 
    /// </summary>
    [Serializable]
    public class IncomingPhoneNumber : BaseFriendlyNameInfo
    {

        #region Constructors

        /// <summary>
        /// Creates a new instance of the IncomingPhoneNumber object.
        /// </summary>
        public IncomingPhoneNumber() : base()
        {
        }

        /// <summary>
        /// Creates a new instance of the IncomingPhoneNumber object.
        /// </summary>
        /// <param name="sid">A 34 character string that uniquely identifies this resource.</param>
        public IncomingPhoneNumber(string sid) : base(sid)
        {
        }

        /// <summary>
        /// Creates a new instance of the IncomingPhoneNumber object.
        /// </summary>
        /// <param name="sid">A 34 character string that uniquely identifies this resource.</param>
        /// <param name="friendlyName">A human readable descriptive text for this resource, up to 64 characters long.</param>
        public IncomingPhoneNumber(string sid, string friendlyName) : base(sid, friendlyName)
        {
        }

        #endregion

        /// <summary>
        /// The 10 digit incoming phone number. Always presented as a 10 digit number, with no "decoration" (like dashes, parentheses, etc.)
        /// </summary>
        [XmlElement]
        public string PhoneNumber { get; set; }

        /// <summary>
        /// The URL that Twilio should POST to when a call is received.
        /// </summary>
        [XmlElement]
        public string Url { get; set; }

        /// <summary>
        /// The HTTP method to use when requesting the above URL. Either GET or POST.
        /// </summary>
        [XmlElement]
        public string Method { get; set; }

    }
}
